package com.atguigu.realtime.suger.mapper;

import com.atguigu.realtime.suger.bean.Keyword;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/11/8 9:06
 */
public interface KeywordMapper {
    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(multiIf(source = 'search', 10, source = 'click', 8, source = 'order', 5, 3)) score\n" +
        "FROM keyword_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword\n")
    List<Keyword> kw(@Param("date") int date);
}
